﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Company.UI.Views
{
    /// <summary>
    /// StatusControl.xaml 的交互逻辑
    /// </summary>
    public partial class StatusControlView : UserControl
    {
        public StatusControlView()
        {
            this.InitializeComponent();
        }
        /// <summary>
        /// 激活画刷颜色(作用于指示灯)
        /// </summary>
        public SolidColorBrush ActiveBrush
        {
            get
            {
                return (SolidColorBrush)base.GetValue(StatusControlView.ActiveBrushProperty);
            }
            set
            {
                base.SetValue(StatusControlView.ActiveBrushProperty, value);
            }
        }
        /// <summary>
        /// 不激活画刷颜色(作用于指示灯)
        /// </summary>
        public SolidColorBrush InactiveBrush
        {
            get
            {
                return (SolidColorBrush)base.GetValue(StatusControlView.InactiveBrushProperty);
            }
            set
            {
                base.SetValue(StatusControlView.InactiveBrushProperty, value);
            }
        }
        /// <summary>
        /// 按钮文字显示内容
        /// </summary>
        public string Label
        {
            get
            {
                return (string)base.GetValue(StatusControlView.LabelProperty);
            }
            set
            {
                base.SetValue(StatusControlView.LabelProperty, value);
            }
        }
        /// <summary>
        /// 是否激活（True:指示灯亮起）
        /// </summary>
        public bool IsActive
        {
            get
            {
                return (bool)base.GetValue(StatusControlView.IsActiveProperty);
            }
            set
            {
                base.SetValue(StatusControlView.IsActiveProperty, value);
            }
        }
        /// <summary>
        /// 是否闪烁
        /// </summary>
        public bool IsBlinking
        {
            get
            {
                return (bool)base.GetValue(StatusControlView.IsBlinkingProperty);
            }
            set
            {
                base.SetValue(StatusControlView.IsBlinkingProperty, value);
            }
        }
        /// <summary>
        /// 第二个指示灯是否激活（True:指示灯亮起）
        /// </summary>
        public bool? IsSecondStatusActive
        {
            get
            {
                return (bool?)base.GetValue(StatusControlView.IsSecondStatusActiveProperty);
            }
            set
            {
                base.SetValue(StatusControlView.IsSecondStatusActiveProperty, value);
            }
        }
        /// <summary>
        /// 第二个指示灯是否闪烁
        /// </summary>
        public bool IsSecondStatusBlinking
        {
            get
            {
                return (bool)base.GetValue(StatusControlView.IsSecondStatusBlinkingProperty);
            }
            set
            {
                base.SetValue(StatusControlView.IsSecondStatusBlinkingProperty, value);
            }
        }
        /// <summary>
        /// 按钮边框是否可见
        /// </summary>
        public bool IsBorderVisible
        {
            get
            {
                return (bool)base.GetValue(StatusControlView.IsBorderVisibleProperty);
            }
            set
            {
                base.SetValue(StatusControlView.IsBorderVisibleProperty, value);
            }
        }
        public static readonly DependencyProperty ActiveBrushProperty = DependencyProperty.Register("ActiveBrush", typeof(SolidColorBrush), typeof(StatusControlView), new PropertyMetadata(Application.Current.TryFindResource("Brush.Good") ?? new BrushConverter().ConvertFromString("#00F976")));

        public static readonly DependencyProperty InactiveBrushProperty = DependencyProperty.Register("InactiveBrush", typeof(SolidColorBrush), typeof(StatusControlView), new PropertyMetadata(Application.Current.TryFindResource("Brush.Overlay12Percent") ?? new BrushConverter().ConvertFromString("#404040")));

        public static readonly DependencyProperty LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(StatusControlView));

        public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register("IsActive", typeof(bool), typeof(StatusControlView));

        public static readonly DependencyProperty IsBlinkingProperty = DependencyProperty.Register("IsBlinking", typeof(bool), typeof(StatusControlView));

        public static readonly DependencyProperty IsSecondStatusActiveProperty = DependencyProperty.Register("IsSecondStatusActive", typeof(bool?), typeof(StatusControlView));

        public static readonly DependencyProperty IsSecondStatusBlinkingProperty = DependencyProperty.Register("IsSecondStatusBlinking", typeof(bool), typeof(StatusControlView));

        public static readonly DependencyProperty IsBorderVisibleProperty = DependencyProperty.Register("IsBorderVisible", typeof(bool), typeof(StatusControlView), new PropertyMetadata(true));
    }
}
